package com.atguigu.springcloud.listener;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.messaging.Message;
import org.springframework.stereotype.Component;

@Component
@EnableBinding(Sink.class)
public class StreamConsumerListener {

    private final Logger log = LoggerFactory.getLogger(StreamConsumerListener.class);

    @StreamListener(Sink.INPUT)
    public void getMessage(Message<String> message) {
        String mess = message.getPayload();
        log.info("消费者端收到消息并消费：{}",mess);
    }
}
